#ifndef _DYNAMIC_BITSET_H_
#define _DYNAMIC_BITSET_H_

#include <cstddef> /* size_t */
#include "types.h"

using namespace std;

class DynamicBitset
{
  public:
	typedef ulong Block;

  private:
	const size_t blockSize; /* The number of bits in a block */
	const size_t indexShift; /* The number of bits that need to be shifted in order to get to the correct block index */
	const size_t inBlockMask; /* A mask that gives the current in-block position of a given index */
	size_t length;
	size_t blocksNumber;
	Block *blocks;


  public:
	DynamicBitset(const size_t setLength);

	~DynamicBitset();

	void set(size_t index);
	bool test(size_t index) const;
	inline size_t count() const;

	inline size_t getBlockSize() const;
	inline void setBlock(size_t blockNum, Block newBlock);

#ifdef DEBUG
	void printBitset() const;
#endif /* DEBUG */
};


#endif /* _DYNAMIC_BITSET_H_ */

